package com.acyouzi.wangyi;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 17/9/25 15:26
 *
 * @author sunxu
 */
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int len = sc.nextInt();
    for(int i = 0; i < len; i++){
      System.out.println(isPossible(sc.nextLong()));
    }
  }

  private static String isPossible(long num) {
    char[] arr = Long.toString(num).toCharArray();
    int len = arr.length;
    Arrays.sort(arr);
    int flag = 2;
    char[] tmp = Long.toString(num*2).toCharArray();
    while (tmp.length == len){
      int index = 0;
      Arrays.sort(tmp);
      while (index < len){
        if (tmp[index] == arr[index]) index++;
        else break;
      }
      if (index == len) return "Possible";
      flag++;

      tmp = Long.toString(num*flag).toCharArray();
    }
    return "Impossible";
  }
}
